<template>
    <tr>
        <td class="check"><input type="checkbox"></td>
        <td class="status">
            <span class="state" v-show="active.state == 0">未审核</span>
            <span class="state" v-show="active.state == 1">已通过</span>
            <span class="state" v-show="active.state == 2">未通过</span>
        </td>
        <td class="type">
            <span>{{active.classifyName}}</span>
        </td>
        <td class="name">
            <span>{{active.name}}</span>
        </td>
        <td class="text"> 
            <span>{{active.particulars}}</span>
        </td>
        <td class="message">
            {{active.participants}}/{{active.totalCount}}
        </td>
        <td class="do">
            <button class="deleteUser" @click="handleDelete(active.id)">注销</button>
            <button class="audite" v-show="active.state===0" @click="examine()">审核</button>
        </td>
    </tr>
</template>

<script>
export default {
    name: 'ActiveadminItem',
    props:['active','searchActives','checkThis'],
    methods:{
        examine(){
            // this.$store.state.dialog = 7;
            // this.$store.state.activeAdmin = this.active
        },
        handleDelete(id){
          if(confirm('您确定要删除吗？')){
            // this.deleteTodo(id)
            axios.post(`http://123.57.251.41:8080/admin-activity/deleteActivity?activityId=${id}`,{headers:{'Authentication-Token': JSON.parse(sessionStorage.getItem("token"))}}).then(
                response =>{
                    console.log('删除成功了')
                    console.log(response.data.data.list)
                    this.searchActives()
                },
                error =>{
                    console.log(id)
                    alert("删除失败了",console.log(error))
                }
            )
          }
        },
        checkthis(id){
            this.checkThis(id)
        }
    }
}
</script>

<style lang="less" scoped>
*{
    box-sizing: border-box;
}
tr{
    background-color: #f9f9f9;
    a{
        color: #337ab7;
    }
    .check{
        width: 7%;
    }
    .status{
        width: 8%;
    }
    .type,.name{
        // max-width: 120px;
        width: 7%;
        padding: 0 10px;
    }
    .message{
        width: 80px;
    }
    .text{
        width: 200px;
    }
    .do{
        width: 50px;
    }
}
td{
    padding:4px;
    font-size: 16px;
    vertical-align: middle;
    text-align: center;
    span{
        display: inline-block;
        // width: 160px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space:nowrap;
        text-align: center;
        img{
            height: 120px;
            margin: 0 2px;
        }
    }
    .photoSpan{
        border-radius: 10px;
        padding: 0;
    }
    input{
        text-overflow: ellipsis;
    }
    button{
        border: 1px solid;
        border-radius: 2px;
        margin-right: 5px;
        font-size: 12px;
        padding: 4px 10px;
        cursor: pointer;
    }
    .deleteUser{
        color: #ff9292;
        background-color: #ffeded;
        border-color: #ffdbdb;
    }
}
</style>